﻿using Sidvall.Serialization;

namespace Sidvall.Net
{
    public class CredentialsSettings
    {
        #region Public Members

        public string Domain { get; set; }
        public string Password { get; set; }
        public string UserName { get; set; }

        #region Copy

        public CredentialsSettings Copy()
        {
            var item = new CredentialsSettings()
            {
                Domain = this.Domain,
                Password = this.Password,
                UserName = this.UserName,
            };
            return item;
        }

        #endregion
        #region IsEqual

        public bool IsEqual(CredentialsSettings obj)
        {
            return IsEqual(this, obj);
        }

        #endregion
        #region IsEqual - Static

        public static bool IsEqual(CredentialsSettings item1, CredentialsSettings item2)
        {
            if (item1 == null)
            {
                if (item2 == null)
                    return true;
                else
                    return false;
            }
            else if (item2 == null)
                return false;
            if (!item1.Domain.Equals(item2.Domain, true, System.StringComparison.OrdinalIgnoreCase))
                return false;
            if (!item1.Password.Equals(item2.Password, true, System.StringComparison.OrdinalIgnoreCase))
                return false;
            if (!item1.UserName.Equals(item2.UserName, true, System.StringComparison.OrdinalIgnoreCase))
                return false;
            return true;
        }

        #endregion

        #endregion
        #region Constructors

        public CredentialsSettings()
        {
        }

        #endregion
    }
}
